package com.bupt.dao;

import com.bupt.bean.ChannelSection;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

public interface SectionRepository extends JpaRepository<ChannelSection,String>, JpaSpecificationExecutor<ChannelSection> {


    @Query(value="SELECT section_name,section_index FROM channel_section_t ORDER BY section_index",nativeQuery=true)
    List<Map<String,Object>> findAllArea();

    List<ChannelSection> findAllByDeviceChannelId(Integer deviceChannelId);

    ChannelSection findByChannelSectionId(Integer channelSectionId);

    void deleteByChannelSectionId(Integer channelSectionId);
}
